package com.bytedance.scenedemo.ability_compatibility.window;

import com.bytedance.scene.Scene;
import com.bytedance.scenedemo.utility.ColorUtil;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;
import ohos.agp.components.ComponentContainer;
import ohos.agp.components.LayoutScatter;
import ohos.agp.utils.Color;


public class WindowColorDemo extends Scene {
    @Override
    public Component onCreateView(LayoutScatter scatter, ComponentContainer container, Intent intent) {
        return new Component(getApplicationContext());
    }

    @Override
    public void onAbilityCreated(Intent intent) {
        super.onAbilityCreated(intent);
        this.getView().setBackground(ColorUtil.getMaterialColor(1));
        requireAbility().getWindow().setStatusBarColor(Color.getIntColor("#4DB6AC"));
        requireAbility().getWindow().setNavigationBarColor(Color.getIntColor("#F06292"));
        requireAbility().getWindow().setStatusBarVisibility(Component.VISIBLE);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        requireAbility().getWindow().setStatusBarColor(Color.getIntColor("#F36D60"));
        requireAbility().getWindow().setNavigationBarColor(Color.getIntColor("#FEFEFE"));
    }
}
